<template>
    <view>
        <web-view :webview-styles="webviewStyles" :src="url"></web-view>
    </view>
</template>

<script>
	import {toLogin} from '@/libs/login.js';
	import {mapGetters} from "vuex";
    export default {
		computed: mapGetters(['isLogin', 'chatUrl', 'userInfo', 'uid']),
        data() {
            return {
                webviewStyles: {
                    progress: {
                        color: '#007AFF'
                    }
                },
				url:'',
				baseUrl: ''
            }
        },
		onShow() {
			var that = this
			if (this.isLogin) {
				this.$store.dispatch('USERINFO');
				setTimeout(function(){
					that.getUrl()
				},500)
			} else{
				toLogin()
			}
			
		},
		onLoad(option) {
			
			this.baseUrl = option.url
			// this.url = option.url+'?phone='+'18932007709'+'&type=gygj&appId=wx62fefe7eb5c751fe&openId=oX4z74qilCGTFgmo9f2FdhAxFTp8'
		},
		methods: {
			getUrl(){
				if(this.userInfo&&this.userInfo.phone&&this.userInfo.openId){
					this.url = this.baseUrl+'?phone='+this.userInfo.phone+'&type=gygj&appId=wx62fefe7eb5c751fe&openId='+this.userInfo.openId
					console.log("this.url",this.url)
				} else {
					uni.navigateBack()
				}
				
			}
		}
    }
</script>

<style>

</style>